<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <title>Examples</title>
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  <meta name="description" content="" />
  <meta name="keywords" content="" />
  <link href="" rel="stylesheet" />
  <style>
    .active {
      font-size: 50px;
      color: yellowgreen;
      font-weight: bold;
    }
  </style>
</head>

<body>
  <div id="root">
    <ul>
      <li v-for="(li,index) in list" @click="handleClick(index)" :class="{active: index === curIndex}">
        {{li}}
      </li>
    </ul>
  </div>
  <script src="../vue.js"></script>
  <script>
    var vm = new Vue({
      el: "#root",
      data: {
        list: ['a', 'b', 'c'],
        // cls:{active: false},
        curIndex: 0
      },

      methods: {
        handleClick(index) {
          // console.log(0)
          // this.cls.active = true;
          this.curIndex = index
        }
      },
    })
    // 去掉run...提示
    Vue.config.productionTip = false
  </script>
</body>

</html>